#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>

using namespace std;

int main()
{
	long long N = 0;
	scanf("%lld", &N);
	long long arr[N] = { 0 };
	long long ans = 0;
	for (int i = 0; i < N; i++)
	{
		scanf("%d", &arr[i]);
	}
	for (int i = 0; i < N; i++)
	{
		if (arr[i] != i + 1)
		{
			for (int j = i + 1; j < N; j++)
			{
				if (arr[j] == i + 1)
				{
					swap(arr[j], arr[i]);
					ans++;
					break;
				}
			}
		}
	}
	printf("%lld", ans);
	return 0;
}